package com.interview.javabase.singleton;

import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @author: zsg
 * @description:
 * @date: 2019/7/7 10:13
 * @modified:
 */
@SpringBootTest
public class TestDemo {

    @Test
    public void test1(){
        Demo1 instance = Demo1.getInstance();
        System.out.println(instance);
    }

    @Test
    public void test2(){
        Demo2 instance = Demo2.INSTANCE;
        System.out.println(instance);
    }

    @Test
    public void test3(){
        Demo3 instance = Demo3.getInstance();
        System.out.println(instance);
    }


    @Test
    public void test4(){
        Demo4 instance = Demo4.getInstance();
        Demo4 instance1 = Demo4.getInstance();
        System.out.println(instance1 == instance);
    }

    @Test
    public void test5(){
        Demo5 instance = Demo5.getInstance();
        Demo5 instance1 = Demo5.getInstance();
        System.out.println(instance1 == instance);
    }
}
